import Main from '@/views/Main.vue';

// 不作为Main组件的子页面展示的页面单独写，如下
export const loginRouter = {
    path: '/login',
    name: 'login',
    meta: {
        title: 'Login - 登录'
    },
    component: () => import('@/views/login.vue')
};

export const page404 = {
    path: '/*',
    name: 'error-404',
    meta: {
        title: '404-页面不存在'
    },
    component: () => import('@/views/error-page/404.vue')
};

export const page403 = {
    path: '/403',
    meta: {
        title: '403-权限不足'
    },
    name: 'error-403',
    component: () => import('@//views/error-page/403.vue')
};

export const page500 = {
    path: '/500',
    meta: {
        title: '500-服务端错误'
    },
    name: 'error-500',
    component: () => import('@/views/error-page/500.vue')
};

export const preview = {
    path: '/preview',
    name: 'preview',
    component: () => import('@/views/form/article-publish/preview.vue')
};

export const locking = {
    path: '/locking',
    name: 'locking',
    component: () => import('@/views/main-components/lockscreen/components/locking-page.vue')
};

// 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里
export const otherRouter = {
    path: '/',
    name: 'otherRouter',
    redirect: '/home',
    component: Main,
    children: [
        { path: 'home', title: {i18n: 'home'}, name: 'home_index', component: () => import('@/views/home/home.vue') },
        // { path: 'ownspace', title: '个人中心', name: 'ownspace_index', component: () => import('@/views/own-space/own-space.vue') },
        // { path: 'order/:order_id', title: '订单详情', name: 'order-info', component: () => import('@/views/advanced-router/component/order-info.vue') }, // 用于展示动态路由
        // { path: 'shopping', title: '购物详情', name: 'shopping', component: () => import('@/views/advanced-router/component/shopping-info.vue') }, // 用于展示带参路由
        { path: 'message', title: '消息中心', name: 'message_index', component: () => import('@/views/message/message.vue') },
        // { path: 'demands/:action_id', title: '需求管理', name: 'demands_index', component: () => import('@/views/houtai/demands/demands.vue') }
    ]
};

// 作为Main组件的子页面展示并且在左侧菜单显示的路由写在appRouter里
export const appRouter = [
    {
        path: '/basics',
        icon: 'ios-people',
        name: 'basics',
        title: '基础管理',
        component: Main,
        children: [
            { path: 'users', title: '用户管理', name: 'users_index', component: () => import('@/views/houtai/users/users.vue') },
            { path: 'company', title: '公司管理', name: 'company', component: () => import('@/views/houtai/company/company.vue') },
            { path: 'roles', title: '角色管理', name: 'roles_index', component: () => import('@/views/houtai/roles/roles.vue') },
            { path: 'permissions', title: '权限管理', name: 'permissions_index', component: () => import('@/views/houtai/permissions/index.vue') },
        ]
    },
    {
        path: '/projects',
        icon: 'ios-person',
        name: 'projects',
        title: '项目需求管理',
        component: Main,
        children: [
            { path: 'projects', title: '项目管理', name: 'projects_index', component: () => import('@/views/houtai/projects/projects.vue') },
            { path: 'actions', title: '功能管理', name: 'actions_index', component: () => import('@/views/houtai/actions/actions.vue') },
            { path: 'demands', title: '需求管理', name: 'demands_index', component: () => import('@/views/houtai/demands/index.vue') },
        ]
    },
    {
        path: '/dev_ops',
        icon: 'social-python',
        name: 'dev_ops',
        title: '运维自动化',
        component: Main,
        children: [
            // { path: 'project_env_switch', title: '项目环境切换', name: 'project_env_switch', component: () => import('@/views/houtai/dev_ops/project_env_switch.vue') },
            { path: 'code_online', title: '代码上线', name: 'code_online', component: () => import('@/views/houtai/dev_ops/code_online.vue') },
            { path: 'log', title: '实时日志', name: 'realTimeLog', component: () => import('@/views/houtai/log/log.vue') }
        ]
    },
    {
        path: '/test_case',
        icon: 'ios-shuffle-strong',
        name: 'test_case',
        title: '测试用例',
        component: Main,
        children: [
            { path: 'projects', title: '项目管理', name: 'projectsApi', component: () => import('@/views/houtai/test_case/projects/projects.vue') },
            { path: 'interfaceGroup', title: '接口分组', name: 'interfaceGroup', component: () => import('@/views/houtai/test_case/interfaceGroup.vue') },
            { path: 'interfaceTest', title: '接口测试', name: 'interfaceTest', component: () => import('@/views/houtai/test_case/interfaceTest/index.vue') },
            { path: 'hostConfig', title: 'Host配置', name: 'hostConfig', component: () => import('@/views/houtai/test_case/hostConfig.vue') },
            { path: 'interfaceDoc', title: '接口文档', name: 'interfaceDoc', component: () => import('@/views/houtai/test_case/interfaceDoc.vue') },
        ]
    }

];

// 所有上面定义的路由都要写在下面的routers里
export const routers = [
    loginRouter,
    otherRouter,
    preview,
    locking,
    ...appRouter,
    page500,
    page403,
    page404
];
